package correct.day31;

import java.util.PriorityQueue;
import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        PriorityQueue<Integer> heap = new PriorityQueue<>();
        for (int i = 0; i < n; i++) {
            int x = scanner.nextInt();
            heap.add(x);
        }
        int days = 0;
        int ret = 0;
        while (ret <= k) {
            int x = heap.poll();
            ret += x;
            heap.add(x * 2);
            days += 1;
        }
        System.out.println(days);
    }
}
